<?php

namespace common\model;

use think\model\RelationModel;

class PlaylistModel extends RelationModel
{

    //自动验证
    protected $_validate = [
        ['name', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['playlist_package_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT], // 必须字段
        ['name', '1,255', '', self::EXISTS_VALIDATE, 'length'],
        ['tenant_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['project_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['step_category_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['step_id', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['created_by', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['created', '', '', self::EXISTS_VALIDATE, 'integer'],
        ['updated', '', '', self::EXISTS_VALIDATE, 'integer'],
    ];

    //自动完成
    protected $_auto = [
        ['tenant_id', 'auto_fill_tenant_id', self::MODEL_INSERT, 'function'],
        ['project_id', 'auto_fill_project_id', self::MODEL_INSERT, 'function_with_data'],
        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
        ['updated', 'time', self::MODEL_BOTH, 'function'],
    ];

}
